package com.woniuxy.hrp.web;

import com.woniuxy.hrp.entity.DoctorAndPatientAndItem;
import com.woniuxy.hrp.entity.DoctorPatientMedicine;
import com.woniuxy.hrp.service.DoctorPatientMedicineService;
import com.woniuxy.hrp.unityhandler.ResponseEntity;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @program: hrph
 * @ClassName DoctorPatientMedicineController
 * @description:
 * @author: LRW
 * @create: 2022-09-08 15:37
 * @Version 1.0
 **/
@Transactional
@RestController
@CrossOrigin
@RequestMapping("/api/v1/DoctorPatientMedicineController")
public class DoctorPatientMedicineController {

    @Autowired
    private DoctorPatientMedicineService doctorPatientMedicineService;

    /***
     * @description: 获取指定就诊记录的用药记录
     * @param: mrecord
     * @return: java.util.List<com.woniuxy.hrp.entity.DoctorAndPatientAndItem>
     * @author Lrw
     * @date: 2022/9/8 15:38
     */
    @GetMapping("/getMedRecords/{mrecord}")
    public ResponseEntity getMitemBymrecord(@PathVariable int mrecord) {
        List<DoctorPatientMedicine> medRecords = doctorPatientMedicineService.selectByMrecordId(mrecord);
        return new ResponseEntity("200","ok",medRecords);
    }
}
